import schedule
import time
import redis


def clear_redis():
    pool = redis.ConnectionPool(host='129.28.67.244')
    r = redis.Redis(connection_pool=pool)
    r.flushall()
    f = open('keyword', 'r', encoding='utf-8')
    for keywords in f.readlines():
        keyword = eval(keywords)[0]
        r.set(keyword, 0)


schedule.every().day.at("0:00").do(clear_redis)

while True:
    schedule.run_pending()
    time.sleep(1)
